package fun.coding.topcoder.singleround;

public class LISNumberDivTwo {

    /**
     * {1, 4, 4, 2, 6, 3} => 4 
     * {5, 8, 9, 12, 16, 32, 50} => 1
     * {1, 1, 9, 9, 2, 2, 3, 3} => 6
     * {5, 4, 3, 2, 1} => 5
     */
    public int calculate(int[] seq) {
        if (seq.length == 1) return 1;
        
        int min = 1;
        
        int i = 0;
        int j = 1;
        
        while (j < seq.length) {
            if (seq[i] >= seq[j]) {
                min++;
            }
            
            i++;
            j++;
        }
        
        return min;
    }
}
